$(function() {

    //var log = console.log;

    $('#conf_del_category').live('click',function(){

        //log(this.id)

        var chk = $('#column').val();

        if(chk==0){

            $('#srvrserror-3').html('molimo odaberite rubriku');
            $('#srvrserror-3').show('slow');

        }else {
            loader();

            $.ajax({
                type: "POST",
                url: base_url+'column/deleteone',
                data: {
                    id: chk
                },
                dataType: 'json',
                success: function(data){

                    if (data.action == true){

                        $.modal.close(); 
                        /*----------------------------------------------------------------------*/
                        /* go to preview article url 
                        /*----------------------------------------------------------------------*/
                        document.location.href = base_url + 'column/preview';

                    }else{

                        alert("Error on server:"+data.msg)

                    }


                }
            })

            return false;
        }

    })

    /***********************************************************
    * LOADERS
    ***********************************************************/

    function loader()
    {
        $.modal(
        "<div><div class='animate'><img src='"+base_url+"assets/img/backgnds/loading.gif'></div><h2>Molim sačekajte...</h2></div>" , {
            closeHTML: "",
            containerCss:{
                height:70,
                width:120,
                borderColor:"#dedede"
            },
            opacity:20,
            overlayCss: {
                backgroundColor: "#000000"
            }
        });
    }

    $('#conf_edit_category').live('click',function(){

        var chk = $('#column').val();

        if(chk==0){

            $('#srvrserror-3').html('molimo odaberite rubriku');
            $('#srvrserror-3').show('slow');

        }else {
            /*----------------------------------------------------------------------*/
            /* go to preview article url 
            /*----------------------------------------------------------------------*/
            document.location.href = base_url + 'column/newform?subcolumnid='+chk;
        }


    })



});